import type { ReceivedDetailVO, ReceivedDetailForm, ReceivedDetailQuery } from './model';

import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';

import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

/**
* 查询收入详情列表
* @param params
* @returns 收入详情列表
*/
export function receivedDetailList(params?: ReceivedDetailQuery) {
  return requestClient.get<PageResult<ReceivedDetailVO>>('/trade/receivedDetail/list', { params });
}

/**
 * 导出收入详情列表
 * @param params
 * @returns 收入详情列表
 */
export function receivedDetailExport(params?: ReceivedDetailQuery) {
  return commonExport('/trade/receivedDetail/export', params ?? {});
}

/**
 * 查询收入详情详情
 * @param id id
 * @returns 收入详情详情
 */
export function receivedDetailInfo(id: ID) {
  return requestClient.get<ReceivedDetailVO>(`/trade/receivedDetail/${id}`);
}

/**
 * 新增收入详情
 * @param data
 * @returns void
 */
export function receivedDetailAdd(data: ReceivedDetailForm) {
  return requestClient.postWithMsg<void>('/trade/receivedDetail', data);
}

/**
 * 更新收入详情
 * @param data
 * @returns void
 */
export function receivedDetailUpdate(data: ReceivedDetailForm) {
  return requestClient.putWithMsg<void>('/trade/receivedDetail', data);
}

/**
 * 删除收入详情
 * @param id id
 * @returns void
 */
export function receivedDetailRemove(id: ID | IDS) {
  return requestClient.deleteWithMsg<void>(`/trade/receivedDetail/${id}`);
}
